import time

from tqdm import trange

from NanNing.common import send_data, RadarNN, FormatVal

if __name__ == '__main__':

    print("--------------------------------\n"
          "|                              |\n"
          "|        确认通道1为主用通道      |\n"
          "|                              |\n"
          "--------------------------------")

    is_send_north = True
    is_send_sector = True
    for i in trange(1000):
        if i > 10:  # 先发十个周期的正常数据
            is_send_north = False
            is_send_sector = False

        # 一路不发正北和扇区数据
        RadarTest1 = send_data(host=RadarNN.HOST, port=RadarNN.PL1, dat_hex=FormatVal.NORMAL,
                               is_send_north=is_send_north,
                               is_send_sector=is_send_sector)
        # 一路发正常数据
        RadarTest2 = send_data(host=RadarNN.HOST, port=RadarNN.PL2, dat_hex=FormatVal.NORMAL)
        # 4秒一周期
        time.sleep(3.99)
